<template>
  <div class="page" v-if="total">
    <el-pagination
      background
      layout="total, sizes, prev, pager, next, jumper"
      :current-page="page"
      :page-size="size"
      :total="total"
      :page-sizes="[5, 10, 20, 50, 100]"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    ></el-pagination>
  </div>
</template>
<script>
export default {
  name: 'page',
  props: {
    page: {
      type: Number,
      default: 1,
    },
    size: {
      type: Number,
      default: 10,
    },
    total: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {}
  },
  methods: {
    handleSizeChange(val) {
      this.$emit('sizeChange', val)
    },
    handleCurrentChange(val) {
      this.$emit('currentChange', val)
    },
  },
}
</script>
<style lang="scss" scoped>
.page {
  padding: 20px 0;
  text-align: right;
  /deep/ .el-pagination {
    color: #fff;
  }
  /deep/ .el-pagination.is-background .btn-next,
  /deep/.el-pagination.is-background .btn-prev,
  /deep/ .el-pagination.is-background .el-pager li {
    color: var(--active-color);
    background: var(--theme-color);
  }
  /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
    color: var(--theme-color);
    background: var(--active-color);
  }
  /deep/.el-pager li:hover {
    color: var(--theme-color) !important;
    background: var(--active-color) !important;
  }
}
</style>
